import { IPSAppModule } from '../ipsapp-module';
import { IPSAppCounterRef } from '../control/ipsapp-counter-ref';
import { IPSAppDataEntity } from '../dataentity/ipsapp-data-entity';
import { IPSAppUILogicRefView } from './ipsapp-uilogic-ref-view';
import { IPSAppView } from '../view/ipsapp-view';
import { IPSAppViewLogic } from '../view/ipsapp-view-logic';
import { IPSAppViewMsgGroup } from '../view/ipsapp-view-msg-group';
import { IPSAppViewNavContext } from '../view/ipsapp-view-nav-context';
import { IPSAppViewNavParam } from '../view/ipsapp-view-nav-param';
import { IPSAppViewParam } from '../view/ipsapp-view-param';
import { IPSAppViewRef } from '../view/ipsapp-view-ref';
import { IPSControl } from '../../control/ipscontrol';
import { IPSNavigateContext } from '../../control/ipsnavigate-context';
import { IPSNavigateParam } from '../../control/ipsnavigate-param';
import { IPSLanguageRes } from '../../res/ipslanguage-res';
import { IPSSysCss } from '../../res/ipssys-css';
import { IPSSysImage } from '../../res/ipssys-image';
import { IPSSysPFPlugin } from '../../res/ipssys-pfplugin';
import { PSModelObjectImpl } from '../../psmodel-object-impl';

export class PSAppUILogicRefViewImpl extends PSModelObjectImpl implements IPSAppUILogicRefView {
  get accUserMode(): 0 | 2 | 3 | 4 {
    return this.M.accUserMode;
  }

  get accessKey(): string {
    return this.M.accessKey;
  }

  protected cappslanguageres: IPSLanguageRes | null = null;

  getCapPSLanguageRes(): IPSLanguageRes | null {
    if (this.cappslanguageres != null) return this.cappslanguageres;
    const value = this.M.getCapPSLanguageRes;
    if (value == null) {
      return null;
    }
    this.cappslanguageres = this.getPSModel4('res.IPSLanguageRes', value, 'getCapPSLanguageRes') as IPSLanguageRes;
    return this.cappslanguageres;
  }

  get capPSLanguageRes(): IPSLanguageRes | null {
    return this.getCapPSLanguageRes();
  }

  getCapPSLanguageResMust(): IPSLanguageRes {
    const value = this.getCapPSLanguageRes();
    if (value == null) {
      throw new Error('未指定标题语言资源');
    }
    return value;
  }

  get caption(): string {
    return this.M.caption;
  }

  get codeName(): string {
    return this.M.codeName;
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  get fullCodeName(): string {
    return this.M.fullCodeName;
  }

  get funcViewMode():
    | 'PICKUPVIEW'
    | 'EDITVIEW'
    | 'MAINVIEW'
    | 'INDEXDEPICKUPVIEW'
    | 'FORMPICKUPVIEW'
    | 'MPICKUPVIEW'
    | 'MDATAVIEW'
    | 'WFEDITVIEW'
    | 'WFMDATAVIEW'
    | 'WFSTARTVIEW'
    | 'WFACTIONVIEW'
    | 'WFUTILACTIONVIEW'
    | 'REDIRECTVIEW'
    | 'MOBPICKUPVIEW'
    | 'MOBEDITVIEW'
    | 'MOBMAINVIEW'
    | 'MOBINDEXDEPICKUPVIEW'
    | 'MOBFORMPICKUPVIEW'
    | 'MOBMPICKUPVIEW'
    | 'MOBMDATAVIEW'
    | 'MOBWFEDITVIEW'
    | 'MOBWFMDATAVIEW'
    | 'MOBWFSTARTVIEW'
    | 'MOBWFACTIONVIEW'
    | 'MOBWFUTILACTIONVIEW'
    | 'MOBREDIRECTVIEW' {
    return this.M.funcViewMode;
  }

  get funcViewParam(): string {
    return this.M.funcViewParam;
  }

  get height(): number {
    return this.M.height != null ? this.M.height : 0;
  }

  get mainMenuAlign(): string {
    return this.M.mainMenuAlign;
  }

  get memo(): string {
    return this.M.memo;
  }

  get name(): string {
    return this.M.name;
  }

  get openMode(): string {
    return this.M.openMode;
  }

  protected psappcounterref: IPSAppCounterRef | null = null;

  getPSAppCounterRef(): IPSAppCounterRef | null {
    if (this.psappcounterref != null) return this.psappcounterref;
    const value = this.M.getPSAppCounterRef;
    if (value == null) {
      return null;
    }
    this.psappcounterref = this.getPSModel4('app.control.IPSAppCounterRef', value, 'getPSAppCounterRef') as IPSAppCounterRef;
    return this.psappcounterref;
  }

  get psAppCounterRef(): IPSAppCounterRef | null {
    return this.getPSAppCounterRef();
  }

  getPSAppCounterRefMust(): IPSAppCounterRef {
    const value = this.getPSAppCounterRef();
    if (value == null) {
      throw new Error('未指定应用计数器引用');
    }
    return value;
  }

  protected psappdataentity: IPSAppDataEntity | null = null;

  getPSAppDataEntity(): IPSAppDataEntity | null {
    if (this.psappdataentity != null) return this.psappdataentity;
    const value = this.M.getPSAppDataEntity;
    if (value == null) {
      return null;
    }
    this.psappdataentity = this.getPSModel4('app.dataentity.IPSAppDataEntity', value, 'getPSAppDataEntity') as IPSAppDataEntity;
    return this.psappdataentity;
  }

  get psAppDataEntity(): IPSAppDataEntity | null {
    return this.getPSAppDataEntity();
  }

  getPSAppDataEntityMust(): IPSAppDataEntity {
    const value = this.getPSAppDataEntity();
    if (value == null) {
      throw new Error('未指定视图应用实体');
    }
    return value;
  }

  protected psappmodule: IPSAppModule | null = null;

  getPSAppModule(): IPSAppModule | null {
    if (this.psappmodule != null) return this.psappmodule;
    const value = this.M.getPSAppModule;
    if (value == null) {
      return null;
    }
    this.psappmodule = this.getPSModel4('app.IPSAppModule', value, 'getPSAppModule') as IPSAppModule;
    return this.psappmodule;
  }

  get psAppModule(): IPSAppModule | null {
    return this.getPSAppModule();
  }

  getPSAppModuleMust(): IPSAppModule {
    const value = this.getPSAppModule();
    if (value == null) {
      throw new Error('未指定应用模块');
    }
    return value;
  }

  protected psappviewlogics: IPSAppViewLogic[] | null = null;

  getPSAppViewLogics(): IPSAppViewLogic[] | null {
    if (this.psappviewlogics == null) {
      this.psappviewlogics = this.fillChildListModel(this.M.getPSAppViewLogics, 'app.view.IPSAppViewLogic') as IPSAppViewLogic[];
    }
    return this.psappviewlogics;
  }

  get psAppViewLogics(): IPSAppViewLogic[] | null {
    return this.getPSAppViewLogics();
  }

  findPSAppViewLogic(objKey: any): IPSAppViewLogic | null {
    return this.getPSModel5('app.view.IPSAppViewLogic', this.getPSAppViewLogics(), objKey) as IPSAppViewLogic;
  }

  protected psappviewmsggroup: IPSAppViewMsgGroup | null = null;

  getPSAppViewMsgGroup(): IPSAppViewMsgGroup | null {
    if (this.psappviewmsggroup != null) return this.psappviewmsggroup;
    const value = this.M.getPSAppViewMsgGroup;
    if (value == null) {
      return null;
    }
    this.psappviewmsggroup = this.getPSModel4('app.view.IPSAppViewMsgGroup', value, 'getPSAppViewMsgGroup') as IPSAppViewMsgGroup;
    return this.psappviewmsggroup;
  }

  get psAppViewMsgGroup(): IPSAppViewMsgGroup | null {
    return this.getPSAppViewMsgGroup();
  }

  getPSAppViewMsgGroupMust(): IPSAppViewMsgGroup {
    const value = this.getPSAppViewMsgGroup();
    if (value == null) {
      throw new Error('[getPSAppViewMsgGroup]返回空值');
    }
    return value;
  }

  protected psappviewnavcontexts: IPSAppViewNavContext[] | null = null;

  getPSAppViewNavContexts(): IPSAppViewNavContext[] | null {
    if (this.psappviewnavcontexts == null) {
      this.psappviewnavcontexts = this.fillChildListModel(this.M.getPSAppViewNavContexts, 'app.view.IPSAppViewNavContext') as IPSAppViewNavContext[];
    }
    return this.psappviewnavcontexts;
  }

  get psAppViewNavContexts(): IPSAppViewNavContext[] | null {
    return this.getPSAppViewNavContexts();
  }

  findPSAppViewNavContext(objKey: any): IPSAppViewNavContext | null {
    return this.getPSModel5('app.view.IPSAppViewNavContext', this.getPSAppViewNavContexts(), objKey) as IPSAppViewNavContext;
  }

  protected psappviewnavparams: IPSAppViewNavParam[] | null = null;

  getPSAppViewNavParams(): IPSAppViewNavParam[] | null {
    if (this.psappviewnavparams == null) {
      this.psappviewnavparams = this.fillChildListModel(this.M.getPSAppViewNavParams, 'app.view.IPSAppViewNavParam') as IPSAppViewNavParam[];
    }
    return this.psappviewnavparams;
  }

  get psAppViewNavParams(): IPSAppViewNavParam[] | null {
    return this.getPSAppViewNavParams();
  }

  findPSAppViewNavParam(objKey: any): IPSAppViewNavParam | null {
    return this.getPSModel5('app.view.IPSAppViewNavParam', this.getPSAppViewNavParams(), objKey) as IPSAppViewNavParam;
  }

  protected psappviewparams: IPSAppViewParam[] | null = null;

  getPSAppViewParams(): IPSAppViewParam[] | null {
    if (this.psappviewparams == null) {
      this.psappviewparams = this.fillChildListModel(this.M.getPSAppViewParams, 'app.view.IPSAppViewParam') as IPSAppViewParam[];
    }
    return this.psappviewparams;
  }

  get psAppViewParams(): IPSAppViewParam[] | null {
    return this.getPSAppViewParams();
  }

  findPSAppViewParam(objKey: any): IPSAppViewParam | null {
    return this.getPSModel5('app.view.IPSAppViewParam', this.getPSAppViewParams(), objKey) as IPSAppViewParam;
  }

  protected psappviewrefs: IPSAppViewRef[] | null = null;

  getPSAppViewRefs(): IPSAppViewRef[] | null {
    if (this.psappviewrefs == null) {
      this.psappviewrefs = this.fillChildListModel(this.M.getPSAppViewRefs, 'app.view.IPSAppViewRef') as IPSAppViewRef[];
    }
    return this.psappviewrefs;
  }

  get psAppViewRefs(): IPSAppViewRef[] | null {
    return this.getPSAppViewRefs();
  }

  findPSAppViewRef(objKey: any): IPSAppViewRef | null {
    return this.getPSModel5('app.view.IPSAppViewRef', this.getPSAppViewRefs(), objKey) as IPSAppViewRef;
  }

  protected pscontrols: IPSControl[] | null = null;

  getPSControls(): IPSControl[] | null {
    if (this.pscontrols == null) {
      this.pscontrols = this.fillChildListModel(this.M.getPSControls, 'control.IPSControl') as IPSControl[];
    }
    return this.pscontrols;
  }

  get psControls(): IPSControl[] | null {
    return this.getPSControls();
  }

  findPSControl(objKey: any): IPSControl | null {
    return this.getPSModel5('control.IPSControl', this.getPSControls(), objKey) as IPSControl;
  }

  get psDEViewCodeName(): string {
    return this.M.getPSDEViewCodeName;
  }

  getPSDEViewCodeName(): string {
    return this.M.getPSDEViewCodeName;
  }

  get psDEViewId(): string {
    return this.M.getPSDEViewId;
  }

  getPSDEViewId(): string {
    return this.M.getPSDEViewId;
  }

  protected psnavigatecontexts: IPSNavigateContext[] | null = null;

  getPSNavigateContexts(): IPSNavigateContext[] | null {
    if (this.psnavigatecontexts == null) {
      this.psnavigatecontexts = this.fillChildListModel(this.M.getPSNavigateContexts, 'control.IPSNavigateContext') as IPSNavigateContext[];
    }
    return this.psnavigatecontexts;
  }

  get psNavigateContexts(): IPSNavigateContext[] | null {
    return this.getPSNavigateContexts();
  }

  findPSNavigateContext(objKey: any): IPSNavigateContext | null {
    return this.getPSModel5('control.IPSNavigateContext', this.getPSNavigateContexts(), objKey) as IPSNavigateContext;
  }

  protected psnavigateparams: IPSNavigateParam[] | null = null;

  getPSNavigateParams(): IPSNavigateParam[] | null {
    if (this.psnavigateparams == null) {
      this.psnavigateparams = this.fillChildListModel(this.M.getPSNavigateParams, 'control.IPSNavigateParam') as IPSNavigateParam[];
    }
    return this.psnavigateparams;
  }

  get psNavigateParams(): IPSNavigateParam[] | null {
    return this.getPSNavigateParams();
  }

  findPSNavigateParam(objKey: any): IPSNavigateParam | null {
    return this.getPSModel5('control.IPSNavigateParam', this.getPSNavigateParams(), objKey) as IPSNavigateParam;
  }

  protected pssyscss: IPSSysCss | null = null;

  getPSSysCss(): IPSSysCss | null {
    if (this.pssyscss != null) return this.pssyscss;
    const value = this.M.getPSSysCss;
    if (value == null) {
      return null;
    }
    this.pssyscss = this.getPSModel4('res.IPSSysCss', value, 'getPSSysCss') as IPSSysCss;
    return this.pssyscss;
  }

  get psSysCss(): IPSSysCss | null {
    return this.getPSSysCss();
  }

  getPSSysCssMust(): IPSSysCss {
    const value = this.getPSSysCss();
    if (value == null) {
      throw new Error('未指定视图界面样式对象');
    }
    return value;
  }

  protected pssysimage: IPSSysImage | null = null;

  getPSSysImage(): IPSSysImage | null {
    if (this.pssysimage != null) return this.pssysimage;
    const value = this.M.getPSSysImage;
    if (value == null) {
      return null;
    }
    this.pssysimage = this.getPSModel4('res.IPSSysImage', value, 'getPSSysImage') as IPSSysImage;
    return this.pssysimage;
  }

  get psSysImage(): IPSSysImage | null {
    return this.getPSSysImage();
  }

  getPSSysImageMust(): IPSSysImage {
    const value = this.getPSSysImage();
    if (value == null) {
      throw new Error('未指定视图图标对象');
    }
    return value;
  }

  protected pssyspfplugin: IPSSysPFPlugin | null = null;

  getPSSysPFPlugin(): IPSSysPFPlugin | null {
    if (this.pssyspfplugin != null) return this.pssyspfplugin;
    const value = this.M.getPSSysPFPlugin;
    if (value == null) {
      return null;
    }
    this.pssyspfplugin = this.getPSModel4('res.IPSSysPFPlugin', value, 'getPSSysPFPlugin') as IPSSysPFPlugin;
    return this.pssyspfplugin;
  }

  get psSysPFPlugin(): IPSSysPFPlugin | null {
    return this.getPSSysPFPlugin();
  }

  getPSSysPFPluginMust(): IPSSysPFPlugin {
    const value = this.getPSSysPFPlugin();
    if (value == null) {
      throw new Error('未指定前端应用插件');
    }
    return value;
  }

  protected parentpsappdataentity: IPSAppDataEntity | null = null;

  getParentPSAppDataEntity(): IPSAppDataEntity | null {
    if (this.parentpsappdataentity != null) return this.parentpsappdataentity;
    const value = this.M.getParentPSAppDataEntity;
    if (value == null) {
      return null;
    }
    this.parentpsappdataentity = this.getPSModel4('app.dataentity.IPSAppDataEntity', value, 'getParentPSAppDataEntity') as IPSAppDataEntity;
    return this.parentpsappdataentity;
  }

  get parentPSAppDataEntity(): IPSAppDataEntity | null {
    return this.getParentPSAppDataEntity();
  }

  getParentPSAppDataEntityMust(): IPSAppDataEntity {
    const value = this.getParentPSAppDataEntity();
    if (value == null) {
      throw new Error('未指定父应用实体');
    }
    return value;
  }

  get priority(): number {
    return this.M.priority != null ? this.M.priority : -1;
  }

  get refFlag(): boolean {
    return this.M.refFlag != null ? this.M.refFlag : true;
  }

  get refMode(): string {
    return this.M.refMode;
  }

  protected refpsappview: IPSAppView | null = null;

  getRefPSAppView(): IPSAppView | null {
    if (this.refpsappview != null) return this.refpsappview;
    const value = this.M.getRefPSAppView;
    if (value == null) {
      return null;
    }
    this.refpsappview = this.getPSModel4('app.view.IPSAppView', value, 'getRefPSAppView') as IPSAppView;
    return this.refpsappview;
  }

  get refPSAppView(): IPSAppView | null {
    return this.getRefPSAppView();
  }

  getRefPSAppViewMust(): IPSAppView {
    const value = this.getRefPSAppView();
    if (value == null) {
      throw new Error('未指定实际引用视图');
    }
    return value;
  }

  protected subcappslanguageres: IPSLanguageRes | null = null;

  getSubCapPSLanguageRes(): IPSLanguageRes | null {
    if (this.subcappslanguageres != null) return this.subcappslanguageres;
    const value = this.M.getSubCapPSLanguageRes;
    if (value == null) {
      return null;
    }
    this.subcappslanguageres = this.getPSModel4('res.IPSLanguageRes', value, 'getSubCapPSLanguageRes') as IPSLanguageRes;
    return this.subcappslanguageres;
  }

  get subCapPSLanguageRes(): IPSLanguageRes | null {
    return this.getSubCapPSLanguageRes();
  }

  getSubCapPSLanguageResMust(): IPSLanguageRes {
    const value = this.getSubCapPSLanguageRes();
    if (value == null) {
      throw new Error('未指定子标题语言资源');
    }
    return value;
  }

  get subCaption(): string {
    return this.M.subCaption;
  }

  get tempMode(): 0 | 1 | 2 {
    return this.M.tempMode != null ? this.M.tempMode : 0;
  }

  get title(): string {
    return this.M.title;
  }

  protected titlepslanguageres: IPSLanguageRes | null = null;

  getTitlePSLanguageRes(): IPSLanguageRes | null {
    if (this.titlepslanguageres != null) return this.titlepslanguageres;
    const value = this.M.getTitlePSLanguageRes;
    if (value == null) {
      return null;
    }
    this.titlepslanguageres = this.getPSModel4('res.IPSLanguageRes', value, 'getTitlePSLanguageRes') as IPSLanguageRes;
    return this.titlepslanguageres;
  }

  get titlePSLanguageRes(): IPSLanguageRes | null {
    return this.getTitlePSLanguageRes();
  }

  getTitlePSLanguageResMust(): IPSLanguageRes {
    const value = this.getTitlePSLanguageRes();
    if (value == null) {
      throw new Error('未指定抬头语言资源');
    }
    return value;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  get viewType(): string {
    return this.M.viewType;
  }

  get width(): number {
    return this.M.width != null ? this.M.width : 0;
  }

  get enableDP(): boolean {
    return this.M.enableDP;
  }

  get enableWF(): boolean {
    return this.M.enableWF;
  }

  get pickupMode(): boolean {
    return this.M.pickupMode != null ? this.M.pickupMode : false;
  }

  get redirectView(): boolean {
    return this.M.redirectView != null ? this.M.redirectView : false;
  }

  get showCaptionBar(): boolean {
    return this.M.showCaptionBar != null ? this.M.showCaptionBar : true;
  }

  get cls(): string {
    return 'PSAppUILogicRefViewImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'app.logic.IPSAppUILogicRefView' || cls == 'app.logic.IPSAppUILogicRefViewBase' || cls == 'control.IPSNavigateParamContainer') return true;
    return super.instanceof(cls);
  }
}
